package com.chain;

import java.util.ArrayList;
import java.util.List;

public abstract class abstractFruiitsort {
	private int weight;
	protected List<String> fruitBox;
	private abstractFruiitsort nextfruitstore;
	public void getFruitBox(){
		System.out.print("weight:"+weight);
		System.out.println("个数："+fruitBox.size());
		for(String t:fruitBox){
			System.out.print(t+",");
		}
		System.out.println(" ");
	}
	public abstractFruiitsort(int weight){
		this.weight=weight;
		fruitBox=new ArrayList<String>();
	}
	public void setnextsort(abstractFruiitsort nextfruitstore){
		this.nextfruitstore=nextfruitstore;
	}
	
	public void sendfruit(int weight,String fruit){
		if(this.weight==weight){
			pushBox(fruit);
		}
		else{
			if(nextfruitstore!=null){
				nextfruitstore.sendfruit(weight, fruit);
			}
		}
	}
	public abstract void pushBox(String fruit);

}
